<?php
    include_once("db_connect.php");
?>

<?php
    include_once("menu.php");
?>

<?php
    (is_numeric($_GET['project']))? $pro = $_GET['project'] : $pro=0;
    $new2 = pg_exec('select pro_name from public.caller_project WHERE pro_id='.$pro);
    $t2 = pg_fetch_array($new2);
    echo "<h2>".$t2['pro_name']."</h2>";
?>

<table border=1>
<tr>
 <td>phone</td>
 <td>count</td>
 <td>done</td>
</tr>

<?php
    $new = pg_exec('select * from public.caller_phones WHERE pro_id='.$pro);
    while($t = pg_fetch_array($new)){
	echo "<tr>";
	echo "<td>".$t['pho_phone']."</td>";
	echo "<td>".$t['pho_count']."</td>";
	echo "<td>".$t['pho_done']."</td>";
	echo "</tr>";
    }
?>

<?php
/*
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$tstart = $mtime; 

    $new = pg_exec('select * from public.caller_phones LIMIT 10');
    $rows = pg_num_rows($new);
    for($i=0;$i<$rows;$i++){
	$rnd[$i]=$i;
    }
    for ($i=0;$i<10;$i++){
      $rows--;
      if($rows>=0) {
	$r = rand(0,$rows);
	$t = pg_fetch_array($new,$rnd[$r]);
	echo "<tr>";
	echo "<td>".$t['pho_phone']."</td>";
	echo "<td>".$t['pho_count']."</td>";
	echo "<td>".$t['pho_done']."</td>";
	echo "</tr>";
	$rnd[$r]=$rnd[$rows];
      }
    }

$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$tend = $mtime;
$totaltime = ($tend - $tstart);
printf ($totaltime);     
*/
?>

</table>

<?php    
    include_once("db_disconnect.php");
?>